from playwright.sync_api import sync_playwright
import time

def test_case():
    print('start case 01')
    with sync_playwright() as p:
        brower=p.chromium.launch(headless=False)
        page=brower.new_page()
        # page.goto('https://www.baidu.com/')
        page.goto('https://www.ctrip.com/')
        print(page.title())
        assert page.title()=='携程旅行网:酒店预订,机票预订查询,旅游度假,商旅管理'
        time.sleep(2)
        # page.fill('input[id=\"kw\"]',"web自动化测试playwright")
        page.fill('input[id=\"_allSearchKeyword\"]',"火车票")
        time.sleep(2)
        page.click("a[id=\"search_button_global\"]")
        assert page.title() == '携程旅行网:酒店预订,机票预订查询,旅游度假,商旅管理'
        time.sleep(5)

    print('case 01 end')